/*题目：输入某年某月某日，判断这一天是这一年的第几天？*/
#include<stdio.h>
int main()
{
    int year,month,day;
    int flag = 0;
    int returnDay = 0;
    scanf("%d %d %d",&year,&month,&day);
    if(year%4==0&&year%100!=0)flag = 1;
    if(year%400==0)flag = 1;
    for(int i = 1;i<month;i++)
    {
        if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)returnDay+=31;
        else if(i==2)
        {
            if(flag==1)returnDay+=29;
            else returnDay+=28;
        }
        else returnDay+=30;
    }
    printf("%d\n",returnDay+day);
    return 0;
}